#ifndef VIRTUALDEVICEPROPERTY_H
#define VIRTUALDEVICEPROPERTY_H

#include <string>
#include <libxml++/libxml++.h>
#include <map>
#include <memory>

#include "xmlserializer.h"
#include "virtualdevicevariable.h"

namespace xvd
{
    class VirtualDeviceProperty: public XmlSerializer
    {
        public:
            VirtualDeviceProperty(const VirtualDeviceProperty& right);
            VirtualDeviceProperty(const xmlpp::Node* node = NULL);
            ~VirtualDeviceProperty();

            enum eAccess
            {
                ReadOnly, ReadWrite
            };

            std::string toXml() const;
            bool fromXml(const std::string& data);

            std::string& name();
            eAccess& access();
            VirtualDeviceVariable& variable();
            const std::string& name() const;
            eAccess access() const;
            const VirtualDeviceVariable& variable() const;

        private:
            static std::map<std::string, eAccess> m_accessmap;
            static eAccess getAccessCode(const std::string& index);

            std::string m_name;
            eAccess m_access;
            VirtualDeviceVariable* m_variable;
    };
}

#endif
